package com.ctvit.sjk.knowledge.user.controller;

import com.alibaba.fastjson2.JSON;
import com.ctvit.sjk.knowledge.core.controller.KnowledgeController;
import com.ruoyi.common.core.domain.AjaxResult;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户管理Controller
 *
 * @author heyingcheng
 * @date 2025/3/22
 */
@RestController
@RequestMapping("knowledge/user_manage")
public class UserManageController extends KnowledgeController {

    /**
     * 查询用户列表
     */
    @GetMapping("{pageNum}/{pageSize}")
    public AjaxResult list(
            @PathVariable int pageNum,
            @PathVariable int pageSize,
            @RequestParam(defaultValue = "email_or_username") String emailOrUsername) {
        String userJsonText = "{\"total\":2,\"records\":[{\"id\":\"2\",\"username\":\"learning\",\"email\":\"learning@qq.com\",\"phone\":\"\",\"is_active\":true,\"role\":\"USER\",\"nick_name\":\"学习用户\",\"create_time\":\"2025-03-21T16:06:01.475590+08:00\",\"update_time\":\"2025-03-21T16:06:01.475602+08:00\",\"source\":\"LOCAL\"},{\"id\":\"1\",\"username\":\"admin\",\"email\":\"admin@qq.com\",\"phone\":\"\",\"is_active\":true,\"role\":\"ADMIN\",\"nick_name\":\"系统管理员\",\"create_time\":\"2025-03-21T11:03:44.572206+08:00\",\"update_time\":\"2025-03-21T11:05:10.905133+08:00\",\"source\":\"LOCAL\"}],\"current\":1,\"size\":20}";
        return success(JSON.parseObject(userJsonText));
    }

}
